{% extends "personal_center/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/public_file/css/PersonnelChooser.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }
        tr {
            height: 35px;
        }
        th {
            text-align: center;
        }
        table {
            table-layout: fixed;
        }
        td:first-child, th:first-child {
            position: sticky;left: 0;z-index: 1;
        }
        thead tr th {
            position: sticky;top: 0;background-color: #E8E8E8;
        }
        th:first-child {
            z-index: 2;
        }
        .li-class {
            list-style: none;margin-top: 2%;color: #0b0b0b;cursor: pointer;
        }
        #Table td {
            text-align: center;border-bottom: #F2F2F2 solid 1px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis;
        }
        #Table1 td {
            text-align: center;border-bottom: #F2F2F2 solid 1px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis;
        }
        #Table2 td {
            text-align: center;border-bottom: #F2F2F2 solid 1px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis;
        }
        #Table3 td {
            text-align: center;border-bottom: #F2F2F2 solid 1px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis;
        }
        #t_table4 td {
            color: #0b0b0b;cursor: pointer;border-bottom: #F2F2F2 solid 1px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;-o-text-overflow: ellipsis;
        }
        #Table tr:hover {
            background: #D8D8D8;color: white;
        }
        #Table1 tr:hover {
            background: #D8D8D8;color: white;
        }
        #Table2 tr:hover {
            background: #D8D8D8;color: white;
        }
        #Table3 tr:hover {
            background: #D8D8D8;color: white;
        }
        #t_table4 tr:hover {
            background: #D8D8D8;color: white;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .search {
            width: 300px;display: flex;float: right;margin: 10px 0;margin-right: 1%;
        }
        .search input {
            vertical-align: middle;float: left;height: 30px;width: 230px;outline: none;border: 1px solid #0070c1;box-sizing: border-box;border-bottom-left-radius: 3px;border-top-left-radius: 3px;
        }
        .search button {
            float: right;flex: 1;height: 30px;width: 70px;line-height: 30px;background-color: #0070c1;color: white;border-style: none;outline: none;border-bottom-right-radius: 3px;border-top-right-radius: 3px;
        }
        .search button i {
            font-style: normal;
        }
        .search button:hover {
            font-size: 16px;
        }
        .shadow_tab {
            box-shadow: #01AAED 0 0 10px;
        }
        .shadow_tab_1 {
            width: 20%;height: 80px;border: #cfcfcf solid 1px;margin: 1%;display: inline-block;vertical-align: top;cursor: pointer;
        }
        .a_tag_cla {
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
        #addForm {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
        #addForm1 {
            width: 800px;height: 620px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: none;z-index: 10100;font-size: 0;
        }
        #title1 {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 50px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        .div_clase {
            display: inline-block;width: 300px;height: 30px;line-height: 30px;font-size: 14px;color: #0b0b0b;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .input-style {
            display: inline-block;width: 100%;height: 35px;font-size: 14px;border: none;background: white;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;
        }
        #page_one button:hover {
            color: red;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        #addForm2 {
            width: 700px;background: #F5F5F5;position: absolute;border: #dfdfdf solid 1px;margin: auto;border-radius: 3px;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 10100;
        }
        #title {
            display: flex;justify-content: space-between;box-sizing: border-box;padding: 0 10px;height: 50px;color: #0b0b0b;cursor: move;width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        #ThreeNavigation div {
            padding-left: 2%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 40px;background: white;border-bottom: #A9A9A9 solid 0.5px;line-height: 40px;padding-left: 1%;color: black;">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>

        <div id="XZ_tag" class="tab_top" onclick="change_mind('XZ')">
            流程图
        </div>

        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
            附件
        </div>

        <div id="caozuo" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>

        <div id="dowload_but"
             style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;display: none;">
            <button id="download"
                    style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;">
                <ul class="nav navbar-nav navbar-right" style="height: 100%;position: relative;">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false" style="color: white;">
                        <span style="margin-left: 20px;">下载</span> <span class="caret"></span>
                    </a>
                    <li class="dropdown" style="width: 100%;height: 100%;">
                        <ul id="dowload_ul" class="dropdown-menu" style="width: 350px;margin-right: 100px;">

                        </ul>
                    </li>
                </ul>
            </button>
        </div>

        <div style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;">
                <a href="javascript:history.go(-1)" style="color: white;">返回</a></button>
        </div>

        <div id="print_but"
             style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;display: none;">
            <button onclick="but_click()" id="print"
                    style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;">
                预览
            </button>
        </div>
        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            {% if is_audit == 'true' %}
                <button id="approve" onclick="online_tag()" class="button_for_control">
                    审批
                </button>
            {% endif %}

            {% if is_edit == "true" %}
                <button id="modification" onclick="summit_fun()" style="width: 100px;height: 30px;margin-top: 5px;border-radius: 3px;border: #1E90FF solid 1px;color: white;background-color: #1E90FF;line-height: 15px;">
                    修改
                </button>
            {% endif %}

            {% if is_stop == 'true' %}
                <button id="is_stop" onclick="operate_button(this.id)" class="button_for_control">
                    终止
                </button>
            {% endif %}

            {% if withdrawal == 'true' %}
                <button onclick="RevokeApproval()" class="button_for_control">
                    撤回审批
                </button>
            {% endif %}
        </div>
    </div>

    <div id="new_models" class="shade1">
        <div id="addForm2">
            <div id="title">
                <h5 id="modal-title" class="modal-title" style="line-height: 40px;width: 15%;margin-left: 1%;display: inline-block;">审批</h5>
                <span onclick="close_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="width: 100%;">
                <div style="width: 98%;height: 150px;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;padding-right: 1%;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        基本信息
                    </div>
                    <div style="width: 100%;height: 125px;padding-left: 1%;">
                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">来文单位：</span>{{ obj.send_company }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">来文字号：</span>{{ obj.send_number }}
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">收文日期：</span>{{ obj.recive_time | date:"Y-m-d H:i" }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">标题：</span>{{ obj.title }}
                            </div>
                        </div>
                    </div>
                </div>

                <div style="width: 98%;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;margin-top: 1%;padding-right: 1%;padding-bottom: 20px;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        意见
                    </div>
                    <div style="width: 100%;">
                        <textarea id="opinion_detail" placeholder="请输入审批意见" style="width: 96%;height: 100px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;" ></textarea>
                    </div>
                    {% if obj.state == "one" %}
                        <select name="" id="leader_prople" style="width: 96%;height: 35px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;cursor: pointer;">
                            <option value="0">请选择分管领导</option>
                            {% for foo in leader_obj %}
                                <option value="{{ foo.id }}">{{ foo.real_name }}</option>
                            {% endfor %}
                        </select>
                    {% endif %}

                    {% if obj.state == "two" %}
                        <input type="text" id="ReadingPersonnel" style="width: 96%;height: 35px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;cursor: pointer;" placeholder="请选择阅示人员" onclick="model_line_with_parameters(this.id)">

                        <input type="text" id="Distributors" style="width: 96%;height: 35px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;cursor: pointer;" placeholder="请选择分发人员" onclick="model_line_with_parameters(this.id)">
                    {% endif %}

                    {% if obj.state == "three" %}
                        <div style="margin-left: 2%;width: 96%;height: 150px;">
                            <div style="width: 150px;height: 150px;display: inline-block;vertical-align: top;">
                                <a href="javascript:;" class="file" style="margin-top: 25px;">
                                    <img src="../../static/personal_center/img/加号_o.png" alt="" onclick="onclick_upload_file()" style="width: 100px;height: 100px;vertical-align: baseline;">
                                    <input type="file" name="regular_main_body" id="regular_main_body" onchange="upload_accessory1('file2', 'regular_main', 'regular_main_body')">
                                </a>
                            </div>

                            <div id="upload_file_list" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;">

                            </div>
                        </div>
                    {% endif %}
                </div>

                <div style="width: 100%;height: 40px;background: white;margin-top: 1%;text-align: right;padding-right: 2%;">
                    <button onclick="summit_data('audit')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;">同意</button>
                    <button onclick="summit_data('draft')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;margin-left: 15px;">退回修改</button>
                </div>

            </div>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;">
        <div style="width: 100%;height: 40px;line-height: 40px;text-align: center;">
            <h3 id="manuscript_title">电 文 处 理 及 阅 文 笺</h3>
        </div>
        <hr>
        <div style="width: 100%;height: 93%;overflow: auto;">
            <div style="width: 90%;height: 40px;line-height: 40px;margin-left: 5%;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;padding-right: 1%;">
                申请详情
            </div>
            <div style="width: 100%;">
                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            接收科室
                        </td>
                        <td id="ngks"
                            style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ obj.apply_user.company.name }}</td>
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            接收人
                        </td>
                        <td id="ngr"
                            style="width: 20%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;">{{ obj.apply_user.real_name }}</td>
                        <td style="width: 10%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            收文编号
                        </td>
                        <td id="gwwh"
                            style="width: 25%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;outline: none;border-top: none;">{{ obj.recive_number }}</td>
                    </tr>
                </table>
                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            <span style="color: red;">* </span>来文单位
                        </td>
                        <td id="lwdw" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.send_company }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            <span style="color: red;">* </span>来文字号
                        </td>
                        <td id="lwzh"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.send_number }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;line-height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            <span style="color: red;">* </span>收文日期
                        </td>
                        <td id="swrq" style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                            <input class="input-style" type="text" name="car_start" id="car_start" value="{{ obj.recive_time|date:'Y-m-d H:i:s' }}" {% if is_edit == "flase" %}disabled{% endif %}>
                        </td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            <span style="color: red;">* </span>标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题
                        </td>
                        <td id="gwbt"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.title }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            <span style="color: red;">* </span>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容
                        </td>
                        <td id="gwnr"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.content }}</td>
                    </tr>
                    {% if is_edit == "true" and charge_flag %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;"><span style="color: red;">* </span>分管领导</td>
                            <td style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;">
                                <select name="" id="leaders" style="width: 100%;height: 100%;border: none;outline: none;">
                                    <option value="0">请选择分管领导</option>
                                    {% for foo in leader_obj %}
                                        <option value="{{ foo.id }}" {% if obj.leaders.id == foo.id %}selected{% endif %}>{{ foo.real_name }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                        </tr>
                    {% endif %}
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            标注文本
                        </td>
                        <td id="bzwb"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.annotated_text }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            时间期限
                        </td>
                        <td id="sjqx"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.time_limit }}</td>
                    </tr>
                    <tr style="width: 100%;">
                        <td style="width: 15%;height: 40px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                            备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注
                        </td>
                        <td id="beizhu"
                            style="width: 85%;height: 40px;line-height: 40px;border: #cccccc solid 1px;border-left: none;padding-left: 1%;border-top: none;outline: none;" contenteditable="{{ is_edit }}">{{ obj.remarks }}</td>
                    </tr>
                </table>
            </div>
            <div style="width: 90%;height: 40px;margin-left: 5%;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;">
                审批详情
            </div>
            <div style="width: 90%;margin-left: 5%;">
                <table style="width: 100%;">
                    {% if 'one' in audit_dic %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 0.7%;border-top: none;letter-spacing: 4px;">
                                医院办公室
                            </td>
                            <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                {% for k,v in audit_dic.items %}
                                    {% if k == 'one' %}
                                        {% for item in v %}
                                            {% if item.state != 'unaudit' %}
                                                <div style="width: 100%;line-height: 20px;position: relative;">
                                                    <span>{{ item.state_display }}</span>
                                                    <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                </div>
                                                <div>
                                                    {% if item.signature_picture %}
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    {% else %}
                                                        {{ item.audit_user }}
                                                    {% endif %}
                                                </div>
                                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endif %}

                    {% if 'two' in audit_dic %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 1px;">
                                分&nbsp;&nbsp;管&nbsp;&nbsp;领&nbsp;&nbsp;导
                            </td>
                            <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                {% for k,v in audit_dic.items %}
                                    {% if k == 'two' %}
                                        {% for item in v %}
                                            {% if item.state != 'unaudit' %}
                                                <div style="width: 100%;line-height: 20px;position: relative;">
                                                    <span>{{ item.state_display }}</span>
                                                    <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                </div>
                                                <div>
                                                    {% if item.signature_picture %}
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    {% else %}
                                                        {{ item.audit_user }}
                                                    {% endif %}
                                                </div>
                                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endif %}

                    {% if 'three' in audit_dic %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                接收科室回执
                            </td>
                            <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                {% for k,v in audit_dic.items %}
                                    {% if k == 'three' %}
                                        {% for item in v %}
                                            {% if item.state != 'unaudit' %}
                                                <div style="width: 100%;line-height: 20px;position: relative;">
                                                    <span>{{ item.state_display }}</span>
                                                    <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                </div>
                                                <div>
                                                    {% if item.signature_picture %}
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    {% else %}
                                                        {{ item.audit_user }}
                                                    {% endif %}
                                                </div>
                                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endif %}

                    {% if 'four' in audit_dic %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 1px;">
                                分&nbsp;&nbsp;管&nbsp;&nbsp;领&nbsp;&nbsp;导
                            </td>
                            <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                {% for k,v in audit_dic.items %}
                                    {% if k == 'four' %}
                                        {% for item in v %}
                                            {% if item.state != 'unaudit' %}
                                                <div style="width: 100%;line-height: 20px;position: relative;">
                                                    <span>{{ item.state_display }}</span>
                                                    <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                </div>
                                                <div>
                                                    {% if item.signature_picture %}
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    {% else %}
                                                        {{ item.audit_user }}
                                                    {% endif %}
                                                </div>
                                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endif %}

                    {% if 'five' in audit_dic %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 0.7%;border-top: none;letter-spacing: 4px;">
                                医院办公室
                            </td>
                            <td style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                {% for k,v in audit_dic.items %}
                                    {% if k == 'five' %}
                                        {% for item in v %}
                                            {% if item.state != 'unaudit' %}
                                                <div style="width: 100%;line-height: 20px;position: relative;">
                                                    <span>{{ item.state_display }}</span>
                                                    <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                </div>
                                                <div>
                                                    {% if item.signature_picture %}
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    {% else %}
                                                        {{ item.audit_user }}
                                                    {% endif %}
                                                </div>
                                                <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                            {% endif %}
                                        {% endfor %}
                                    {% endif %}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endif %}
                </table>
            </div>
            {% if is_edit == 'true' %}
                <div id="fujian_div" style="width: 90%;margin-left: 5%;">
                    <div style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                        <span style="color: red;">* </span>附件
                        <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                            上传附件
                            <input type="file" name="regular_main_body" id="regular_main_body"
                                   onchange="upload_accessory('file1', 'regular_main', 'regular_main_body')">
                        </a>
                    </div>
                    <table style="width: 100%;">
                    <thead>
                    <tr>
                        <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件名称</td>
                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">文件大小</td>
                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传时间</td>
                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">上传人员</td>
                        <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作</td>
                    </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="regular_main">
                        {% for record in file_list %}
                            <tr>
                                <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">{{ forloop.counter }}</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_name }}</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_size }}</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.upload_time }}</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.uploader }}</td>
                                <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                    <a target='_blank' href="{{ record.file_path }}">查看</a> | <a style="color: red;" href='#' onclick='RemoveTr(this, "party_main", {{ record.id }})'>删除</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
                </div>
            {% endif %}
            {% if ReceivingList|length %}
                <div id="shouyue"
                     style="width: 90%;height: 40px;margin-left: 5%;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;padding-right: 1%;">
                    阅示详情
                </div>
                <div style="width: 90%;margin-left: 5%;">
                    <table style="width: 100%;">
                        <tr style="width: 100%;">
                            <td style="width: 100%;border: #cccccc solid 1px;border-top: none;outline: none;padding-left: 1%;">
                                <div style="width: 100%;position: relative;">
                                    {% for receiv in ReceivingList %}
                                        {% if receiv.state == 'accepted' %}
                                            <div style="width: 100%; height: 80px; border-bottom: 1px solid rgb(204, 204, 204);">
                                                <div><span>已阅</span></div>
                                                <div>
                                                    <img style="width: 100px;height: 40px;" src="{{ receiv.signature_picture }}">
                                                </div>
                                                <div style="position: absolute; right: 0px; width: 300px; text-align: right; color: rgb(11, 11, 11); line-height: 0px;">{{ receiv.time }}</div>
                                            </div>
                                        {% else %}
                                            <div style="width: 100%; height: 80px; border-bottom: 1px solid rgb(204, 204, 204);">
                                                <div><span>未阅</span></div>
                                                <div>
                                                    {{ receiv.receiving }}
                                                </div>
                                            </div>
                                        {% endif %}
                                    {% endfor %}


                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            {% endif %}
        </div>
    </div>

    <div id="XZ" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% if 'one' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'one' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                医院办公室
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'two' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'two' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                分管领导
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'three' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'three' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                接收科室回执
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'four' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'four' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                分管领导
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'five' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'five' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                医院办公室
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div id="yt_zhengwen" style="width: 100%;">
                {% for item in file_list %}
                    {% if item.file_type == '0' %}
                        <div><a href="#" class="a_tag_cla" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                    {% endif %}
                {% endfor %}
            </div>
            {% if obj.state == 'three' or obj.state == 'four' or obj.state == 'five' or obj.state == 'six' %}
                <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                    接收回执
                </div>
                <div id="yt_zhengwen1" style="width: 100%;">
                    {% for item in file_list %}
                        {% if item.file_type == '1' %}
                            <div><a href="#" title="{{ item.file_name }}" class="a_tag_cla" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}
        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="staff-select" class="shade" style="z-index: 11000">
        <div id="staff-model" style="width: 100%;height: 100%;position: absolute;">
            <div style="width: 900px;height: 500px;background: #F5F5F5;z-index: 11100;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
                <div id="staff-box" style="width: 100%;height: 40px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 20%;margin-left: 1%;display: inline-block;line-height: 40px;font-size: 14px;">
                        选择人员
                    </div>
                    <span onclick="close_model()" style="float: right;padding-right: 2%;cursor: pointer;line-height: 38px;">
                        <i class="iconfont icon-quchu"></i>
                    </span>
                </div>
                <div style="height: 460px;width: 100%;border-bottom: #dfdfdf solid 1px;">
                    <div style="width: 70px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div id="dep" class="navigation navigation_color" onclick="change_navigation(this)">部门</div>
                        <div id="limits" class="navigation" onclick="change_navigation(this)">权限</div>
                        <div id="fun" class="navigation" onclick="change_navigation(this)">职能</div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;">
                            <input id="SearchDep" onkeydown="SearchDepartment()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 95%;">
                        </div>
                        <div id="SecondaryNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 200px;height: 100%;border-right: #cfcfcf solid 1px;display: inline-block;vertical-align: top;">
                        <div style="width: 100%;height: 50px;line-height: 50px;padding-left: 2%;">
                            <input type="checkbox" id="select-all" onclick="SelectAll(this)">
                            <input id="SearchPeo" onkeydown="SearchProple()" class="search_input" type="text" placeholder="搜索" autocomplete="off" style="width: 87%;">
                        </div>
                        <div id="ThreeNavigation" style="width: 100%;height: 403px;line-height: 50px;overflow: auto;"></div>
                    </div>
                    <div style="width: 410px;height: 100%;display: inline-block;vertical-align: top;overflow: auto">
                        <div style="width: 100%;height: 40px;text-align: left;font-size: 14px;line-height: 40px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;已选 <span id="selected-number">0</span> 人
                        </div>
                        <div id="selected-div" style="width: 100%;font-size: 14px;height: 370px;overflow: auto;line-height: 20px;">

                        </div>

                        <div style="width: 100%;font-size: 14px;height: 40px;text-align: center;">
                            <button id="finish_with" onclick="IdentifyPersonnel()" style="width: 100px;height: 30px;line-height: 25px;text-align: center;letter-spacing: 5px;border-radius: 3px;border: #cfcfcf solid 1px;font-size: 14px;cursor: pointer;margin-top: 10px;">完成</button>
                            <button onclick="close_model()" style="margin-left: 15px;width: 100px;height: 30px;line-height: 25px;text-align: center;color: #0abb78;letter-spacing: 5px;border-radius: 3px;font-size: 14px;border: #cfcfcf solid 1px;cursor: pointer;margin-top: 10px;">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}


{% block script %}
    <script language="javascript" src="../../static/personal_center/js/jquery-1.4.4.min.js"></script>
    <script language="javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="../../static/personal_center/js/other/jquery.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script src="../../static/public_file/js/PersonnelChoosersNew.js" type="text/javascript" charset="gb2312"></script>
    <script>
        window.onload = function () {
            document.getElementById("sponsor").className = "add_class";
            document.getElementById("personage").className = "add-nav-active";
        };

        var uuid = "{{ uuid | safe }}";

        if ("{{ is_edit }}" === "true") {
            lay('#version').html('-v' + laydate.v);
            //执行一个laydate实例
            laydate.render({
                elem: '#car_start' //指定元素
            });
        }

        function check_dep_ff(ele_name, ele_id) {
            var processed_prople = document.getElementById("processed_prople");
            var span = document.createElement("span");
            if (!document.getElementById(ele_id).checked) {
                document.getElementById('cc-' + ele_id).remove();
            }
            if (document.getElementById(ele_id).checked) {
                span.innerText = ele_name;
                span.setAttribute("id", 'cc-' + ele_id);
                span.style.fontSize = '14px';
                span.style.marginLeft = "10px";
                processed_prople.appendChild(span);
            }
        }


        // 上传正文
        function upload_accessory(file_type, tbody_id, accessory_type, bh_id) {
            document.getElementById("loading").style.display = "inline-block";
            var bill_id = window.location.href.split('id=')[1].replace("#", '')
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', uuid);
            form.append('source', "lw");
            form.append('bill_id', bill_id);

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 400) {
                            alert("请上传xlsx格式文件！")
                        }
                        creat_table(JsonDate, tbody_id)
                    }
                }
            };
        }

        function upload_accessory1(file_type, tbody_id, accessory_type, bh_id) {
            document.getElementById("loading").style.display = "inline-block";
            var bill_id = window.location.href.split('id=')[1].replace("#", '')
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', uuid);
            form.append('source', "wblh");
            form.append('bill_id', bill_id);

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate["code"] === 400) {
                            alert("请上传xlsx格式文件！")
                        }
                        creat_table1(JsonDate, tbody_id)
                    }
                }
            };
        }

        function summit_fun() {
            var charge_flag = "{{ charge_flag | safe }}";
            var leaders_people = "";
            var swbh = document.getElementById("gwwh").innerText;           // 收文编号
            var lwdw = document.getElementById("lwdw").innerText;           // 来文单位
            var lwzh = document.getElementById("lwzh").innerText;           // 来文字号
            var swrq = document.getElementById("car_start").value;          // 收文日期
            var gwbt = document.getElementById("gwbt").innerText;           // 收文标题
            var gwnr = document.getElementById("gwnr").innerText;           // 收文内容
            var bzwb = document.getElementById("bzwb").innerText;           // 标注文本
            var sjqx = document.getElementById("sjqx").innerText;           // 时间期限
            var beizhu = document.getElementById("beizhu").innerText;       // 来文备注

            if (!lwdw) {
                alert("来文单位不能为空！")
                return false
            } else if (!lwzh) {
                alert("来文字号不能为空！")
                return false
            } else if (!swrq) {
                alert("收文日期不能为空！")
                return false
            } else if (!gwbt) {
                alert("标题不能为空！")
                return false
            } else if (!gwnr) {
                alert("内容不能为空！")
                return false
            }
            var t_table = document.getElementById('regular_main').childNodes.length;
            if (t_table === 0) {
                alert("请上传正文！")
                return false
            }

            if (charge_flag === "True") {
                leaders_people = document.getElementById("leaders").value;
                if (leaders_people === "0") {
                    alert("请选择分管院长！")
                    return false
                }
            }

            document.getElementById("loading").style.display = "inline-block";
            var send_str = "send_number=" + String(lwzh) + "&recive_number=" + swbh + "&send_company=" + lwdw + "&recive_time=" + swrq + "&title=" + gwbt + "&content=" + gwnr + "&annotated_text=" + bzwb + "&time_limit=" + sjqx + "&uuid=" + uuid + "&rake_up=ture" + "&beizhu=" + beizhu+"&leaders_people="+leaders_people+"&charge_flag="+charge_flag;
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/ExternalCorrespondenceIndex.html", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send(send_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("修改成功！")
                        window.location.href = '/personal-center/process_management.html?type=我的申请&folw_type=公文管理&folw=外部来函&page=1&page_size=20&wd=';
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData) {
            var t_table = document.getElementById("regular_main");
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var tr = document.createElement("tr");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                    td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["pdf_path"][i]["id"] + "\")'>删除</a>";
                    td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1) {
                    document.getElementById("del_adjunct").style.display = 'block';
                }
            } else {
                tr = document.createElement("tr");td1 = document.createElement("td");td2 = document.createElement("td");td3 = document.createElement("td");td4 = document.createElement("td");td5 = document.createElement("td");td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"regular_main\", \"" + JsonData["id"] + "\")'>删除</a>";
                td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);t_table.appendChild(tr);
            }
        }

        function creat_table1(JsonData) {
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var html_str = `
                        <div style="width: 100%;height: 40px;line-height: 40px;">
                            <div style="width: 79%;height: 100%;display: inline-block;vertical-align: top;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                                <a target='_blank' id="Receipt" href="`+JsonData["pdf_path"][i]["pdf_path"]+`">`+JsonData["file_name"]+`</a>
                            </div>
                            <div onclick="RemoveTr(this, '`+JsonData["pdf_path"][i]["id"]+`')" style="width: 18%;height: 100%;display: inline-block;vertical-align: top;text-align: center;font-size: 12px;cursor: pointer;color: red;">
                                删除
                            </div>
                        </div>
                    `
                    $("#upload_file_list").append(html_str)
                }
            } else {
                html_str = `
                    <div style="width: 100%;height: 40px;line-height: 40px;">
                        <div style="width: 79%;height: 100%;display: inline-block;vertical-align: top;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                            <a target='_blank' id="Receipt" href="`+JsonData["pdf_path"]+`">`+JsonData["file_name"]+`</a>
                        </div>
                        <div onclick="RemoveTr(this, '`+JsonData["id"]+`')" style="width: 18%;height: 100%;display: inline-block;vertical-align: top;text-align: center;font-size: 12px;cursor: pointer;color: red;">
                            删除
                        </div>
                    </div>
                `
                $("#upload_file_list").append(html_str)
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i = 0; i < table.children.length; i++) {
                table.children[i].children[0].innerHTML = i + 1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id=" + String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function show_model() {
            document.getElementById("addForm").style.display = "table-row";
        }

        function close_models1() {
            document.getElementById("addForm").style.display = "none";
        }

        let title1 = document.querySelector("#title");
        let addForm2 = document.querySelector("#addForm2");

        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm2.offsetLeft;
            let y = e.pageY - addForm2.offsetTop;

            document.addEventListener("mousemove", move);

            function move(e) {
                addForm2.style.left = e.pageX - x + 'px';
                addForm2.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });


        // 所有收阅人
        function all_recive(recive_data, Table) {
            var tr = document.createElement("tr");
            var td = document.createElement("td");
            var td1 = document.createElement("td");
            var td2 = document.createElement("td");
            var td3 = document.createElement("td");
            td.innerHTML = recive_data["user"];
            td.style.textAlign = "center";
            td1.style.textAlign = "center";
            td3.style.textAlign = "center";
            if (recive_data["state"] === "未读") {
                td1.innerHTML = "未收阅";
            } else {
                td1.innerHTML = "已收阅";
            }
            td2.innerHTML = recive_data["update_time"];
            td2.style.textAlign = "center";
            if (!recive_data["signature_picture"] && recive_data["state"] !== "未读") {
                td3.innerHTML = recive_data["user"];
            } else if (recive_data["state"] !== "未读") {
                td3.innerHTML = "<img src='" + recive_data["signature_picture"] + "' style='width: 100px;height: 40px;'>";
            }
            tr.appendChild(td);
            tr.appendChild(td1);
            tr.appendChild(td2);
            tr.appendChild(td3);
            Table.appendChild(tr);
        }

        // 已收阅
        function recive_people(recive_data, Table) {
            var tr = document.createElement("tr");
            var td = document.createElement("td");
            var td1 = document.createElement("td");
            var td2 = document.createElement("td");
            var td3 = document.createElement("td");
            td.innerHTML = recive_data["user"];
            td.style.textAlign = "center";
            td1.style.textAlign = "center";
            td3.style.textAlign = "center";
            td1.innerHTML = "已收阅";
            td2.innerHTML = recive_data["update_time"];
            td2.style.textAlign = "center";
            if (!recive_data["signature_picture"] && recive_data["state"] !== "未读") {
                td3.innerHTML = recive_data["user"];
            } else if (recive_data["state"] !== "未读") {
                td3.innerHTML = "<img src='" + recive_data["signature_picture"] + "' style='width: 100px;height: 40px;'>";
            }
            tr.appendChild(td);
            tr.appendChild(td1);
            tr.appendChild(td2);
            tr.appendChild(td3);
            Table.appendChild(tr);
        }

        // 未收阅
        function no_recive(recive_data, Table) {
            var tr = document.createElement("tr");
            var td = document.createElement("td");
            var td1 = document.createElement("td");
            var td2 = document.createElement("td");
            var td3 = document.createElement("td");
            td.innerHTML = recive_data["user"];
            td.style.textAlign = "center";
            td1.style.textAlign = "center";
            td3.style.textAlign = "center";
            td1.innerHTML = "未收阅";
            td2.innerHTML = recive_data["update_time"];
            td2.style.textAlign = "center";
            if (recive_data["signature_picture"] === "/media/") {
                td3.innerHTML = recive_data["user"];
            } else if (recive_data["state"] !== "未读") {
                td3.innerHTML = recive_data["signature_picture"];
            }
            tr.appendChild(td);
            tr.appendChild(td1);
            tr.appendChild(td2);
            tr.appendChild(td3);
            Table.appendChild(tr);
        }

        // 删除列表
        function deltr() {
            var tb = document.getElementById('Table');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index + 1)
            var arr = ['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index = arr.indexOf(ext);
            if (ext_index === -1) {
                fujian.innerHTML = '<embed id="embed_file" src="' + file_path + '" type="" style="width: 100%;height: 100%;">'
            } else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0; i < a_tag_list.length; i++) {
                a_tag_list[i].style.background = '';
            }
            this_.style.background = '#cfcfcf';
        }

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("XZ_tag").className = "tab_top";
                document.getElementById("XZ").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
                document.getElementById("dowload_but").style.display = "none";
            } else if (ele_id === "XZ") {
                document.getElementById("XZ").style.display = "inline-block";
                document.getElementById("XZ_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
                document.getElementById("dowload_but").style.display = "none";
            } else {
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("XZ_tag").className = "tab_top";
                document.getElementById("XZ").style.display = "none";
                document.getElementById("dowload_but").style.display = "inline-block";
            }
        }

        function online_tag() {
            document.getElementById("new_models").style.display = "table-row";
        }

        function close_models() {
            document.getElementById("new_models").style.display = "none";
        }

        function summit_data(approve) {
            var form = new FormData();
            var flow_state = "{{ obj.state }}";
            var audit_note = document.getElementById("opinion_detail").value;
            if (approve === "draft") {
                if (!audit_note) {
                    alert("不同意请填写理由！");
                    return false
                }
            }
            form.append('id', "{{ obj.id }}");
            form.append('opinion_detail', audit_note);
            form.append('approve', approve);

            if (flow_state === 'one') {
                var leader_prople = document.getElementById("leader_prople").value;
                if (leader_prople === "0") {
                    alert("请选择分管领导！")
                    return false
                }
                form.append('leader_prople', document.getElementById("leader_prople").value);
            }

            if (flow_state === 'two' && approve === "audit") {
                var Distributors = document.getElementById("Distributors").value;
                var ReadingPersonnel = document.getElementById("ReadingPersonnel").value;
                if (!Distributors) {
                    alert("请选择分发人员！")
                    return false
                }
                form.append('Distributors', document.getElementById("Distributors").value);
                form.append('ReadingPersonnel', ReadingPersonnel);
            }

            if (flow_state === 'three') {
                if (document.getElementById("Receipt")) {
                    var Receipt = document.getElementById("Receipt").href;
                }else {
                    Receipt = ""
                }
                form.append('Receipt', Receipt);
            }
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/new-flow-logic/external_correspondence_superiors");
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = "/personal-center/process_management.html?type=我的待办&folw_type=公文管理&folw=外部来函&page=1&page_size=20&wd=";
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function shuji_yz_shenpi() {
            var present_id = window.location.href.split("id=")[1].replace("#", '');
            var audit_result = $("input[type=radio][name=check]:checked").val();
            var opinion_detail_sj_yz = document.getElementById("opinion_detail_sj_yz").value;

            if (audit_result === "draft") {
                if (!opinion_detail_sj_yz) {
                    alert("请填写审批意见！");
                    return false
                }
            }
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/official_documents_detail_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + present_id + "&audit_note=" + String(opinion_detail_sj_yz) + "&state=" + String(audit_result));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = "/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd=";
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function fenguan_shenpi() {
            var present_id = window.location.href.split("id=")[1].replace("#", '');
            var opinion_detail_fg = document.getElementById("opinion_detail_fg").value;
            var audit_result = $("input[type=radio][name=check1]:checked").val();
            if (!opinion_detail_fg) {
                alert("请填写审批意见！");
                return false
            }

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/official_documents_detail_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + present_id + "&audit_note=" + String(opinion_detail_fg) + "&state=" + String(audit_result));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = "/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd=";
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function sq_to_fg() {
            var present_id = window.location.href.split("id=")[1].replace("#", '');
            var shenpi_people = document.getElementById("ld_xz").value;
            if (!shenpi_people) {
                alert("请选择分管人员！");
                return false
            }
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP               +"&fg_people="+String(shenpi_people)
            xhr.open('post', "/administrative/official_documents_detail_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + present_id + "&fg_people=" + String(shenpi_people));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = "/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd=";
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }


        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        function summit_val(chose_type) {
            var prople_list = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            var ExecutorPeople = prople_list.join();
            document.getElementById(chose_type).value = ExecutorPeople;
            close_model();
        }

        function Change_tab(change_number) {
            if (change_number === 1) {
                document.getElementById("tab_1").className = "shadow_tab shadow_tab_1";
                document.getElementById("tab_2").className = "shadow_tab_1";
                document.getElementById("tab_3").className = "shadow_tab_1";
                document.getElementById("tab_one").style.display = "inline-block";
                document.getElementById("tab_two").style.display = "none";
                document.getElementById("tab_three").style.display = "none";
                document.getElementById("tab_4").className = "shadow_tab_1";
                document.getElementById("tab_four").style.display = "none";
            } else if (change_number === 2) {
                document.getElementById("tab_1").className = "shadow_tab_1";
                document.getElementById("tab_2").className = "shadow_tab shadow_tab_1";
                document.getElementById("tab_3").className = "shadow_tab_1";
                document.getElementById("tab_two").style.display = "inline-block";
                document.getElementById("tab_one").style.display = "none";
                document.getElementById("tab_three").style.display = "none";
                document.getElementById("tab_4").className = "shadow_tab_1";
                document.getElementById("tab_four").style.display = "none";
            } else if (change_number === 3) {
                document.getElementById("tab_1").className = "shadow_tab_1";
                document.getElementById("tab_2").className = "shadow_tab_1";
                document.getElementById("tab_3").className = "shadow_tab shadow_tab_1";
                document.getElementById("tab_three").style.display = "inline-block";
                document.getElementById("tab_two").style.display = "none";
                document.getElementById("tab_one").style.display = "none";
                document.getElementById("tab_4").className = "shadow_tab_1";
                document.getElementById("tab_four").style.display = "none";
            } else {
                document.getElementById("tab_1").className = "shadow_tab_1";
                document.getElementById("tab_2").className = "shadow_tab_1";
                document.getElementById("tab_3").className = "shadow_tab_1";
                document.getElementById("tab_4").className = "shadow_tab shadow_tab_1";
                document.getElementById("tab_four").style.display = "inline-block";
                document.getElementById("tab_two").style.display = "none";
                document.getElementById("tab_one").style.display = "none";
                document.getElementById("tab_three").style.display = "none";
            }
        }

        // 收阅详情
        function attention_func(dict_data, relative_div) {
            var divTag = document.createElement("div");
            divTag.style.position = "relative;";
            divTag.style.width = "100%";
            divTag.style.height = "80px";
            divTag.style.borderBottom = "#cccccc solid 1px";
            var div_tag_0 = document.createElement("div");
            div_tag_0.innerHTML = "<span>已收阅</span>";
            var div_tag_1 = document.createElement("div");
            div_tag_1.style.position = "absolute";
            div_tag_1.style.right = "0";
            div_tag_1.style.width = "300px";
            div_tag_1.style.textAlign = "right";
            div_tag_1.style.color = "#0b0b0b";
            div_tag_1.style.lineHeight = "0px";
            div_tag_1.innerText = dict_data["update_time"];
            var div_tag_2 = document.createElement("div");
            if (dict_data["signature_picture"]) {
                div_tag_2.innerHTML = "<img style='width: 100px;height: 40px;' src='" + dict_data["signature_picture"] + "'>"
            } else {
                div_tag_2.innerHTML = dict_data["user"]
            }
            divTag.appendChild(div_tag_0);
            divTag.appendChild(div_tag_2);
            divTag.appendChild(div_tag_1);
            relative_div.appendChild(divTag);
        }

        function please_find_opinion(eve_name) {
            if (eve_name === 'b') {
                document.getElementById("PleaseFindOpinion").style.display = "inline-block";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            } else if (eve_name === 'f') {
                document.getElementById("return_opinion").style.display = "inline-block";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            } else if (eve_name === 'c') {
                document.getElementById("sj_return_opinion").style.display = "inline-block";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            } else if (eve_name === 'd') {
                document.getElementById("yz_return_opinion").style.display = "inline-block";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            } else if (eve_name === 'e') {
                document.getElementById("sy_return_opinion").style.display = "inline-block";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            } else if (eve_name === 'g') {
                document.getElementById("DirectorDistribution").style.display = "inline-block";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
            } else {
                document.getElementById("PleaseFindOpinion").style.display = "none";
                document.getElementById("return_opinion").style.display = "none";
                document.getElementById("yz_return_opinion").style.display = "none";
                document.getElementById("sj_return_opinion").style.display = "none";
                document.getElementById("sy_return_opinion").style.display = "none";
                document.getElementById("DirectorDistribution").style.display = "none";
            }
        }

        function Distribution_department() {
            var xhr = new XMLHttpRequest();
            var document_id = window.location.href.split("id=")[1].replace("#", '');
            var prople_list = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/official_documents_receive");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            var message = $("input[type=radio][name=message]:checked").val();
            xhr.send("id=" + String(document_id) + "&receive_people=" + prople_list.join() + "&message=" + message);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        alert("分发成功！")
                        console.log(JsonDate);
                        window.location.href = "/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd=";
                    }
                }
            };
        }

        function disp_peo(types) {
            if (types === 1) {
                document.getElementById("peoples_check").style.display = "inline-block";
            }
            if (types === 2) {
                document.getElementById("peoples_check").style.display = "none";
            }
        }

        function but_click() {
            document.getElementById("loading").style.display = "inline-block";
            var docement_id = window.location.href.split('id=')[1];
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/ask_preview");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id=" + docement_id);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate)
                        window.open(JsonDate["data"][0]["file_path"]);
                    }
                }
            };
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        // 来文详情页撤回、终止、作废操作
        function operate_button(ele_id) {
            var url = window.location.href;
            var id = url.split("id=")[1];
            console.log(ele_id)
            if (ele_id === 'is_stop') {
                var state = 'stop';     // 终止
                var word = '终止'
            } else {
                state = 'recall'
                word = '撤回'
            }
            var r = confirm('是否' + word + '流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/new-flow-logic/superiors_stop", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            alert(JsonDate['message'])
                            window.location.href = "/personal-center/superiorJeremy.html"
                        }
                    }
                };
            }
        }

        function scrollConversationScreen() {
            $('#selected-div').scrollTop($('#selected-div')[0].scrollHeight);
        }

        function IdentifyPersonnel(item_id) {
            var prople_list = [];
            var selected_personnel_list = document.getElementsByClassName('selected-personnel');
            for (var i=0; i<selected_personnel_list.length; i++) {
                prople_list.push(selected_personnel_list[i].innerText)
            }
            document.getElementById(item_id).value = prople_list.join();
            close_model()
        }

        function onclick_upload_file() {
            document.getElementById("regular_main_body").click();
        }

        function RevokeApproval() {
            var id = "{{ obj.id | safe }}";
            var r = confirm('是否撤回已审批的意见？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                xhr.open('post', "/new-flow-logic/superiors_approval", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            alert(JsonDate['message'])
                            window.location.reload();
                        }
                    }
                };
            }
        }
    </script>
{% endblock %}
